Skip to content

add ExecutorTool.newVirtualThreadPerTaskExecutor(threadFactory)#38

Merged
maxxedev merged 1 commit intomainfrom
issue-37-executor-tool-thread-factory
Jun 3, 2025
Merged

add ExecutorTool.newVirtualThreadPerTaskExecutor(threadFactory)#38
maxxedev merged 1 commit intomainfrom
issue-37-executor-tool-thread-factory

Conversation

@maxxedev
Copy link
Contributor

@maxxedev maxxedev commented Jun 3, 2025

Add to ExecutorTool:

ExecutorService newVirtualThreadPerTaskExecutor(ThreadFactory threadFactory)

useful when refactoring legacy code:

ThreadFactory threadFactory = ...
ExecutorTool.ifSafeVirtualThreads(() -> ExecutorTool.newVirtualThreadPerTaskExecutor(threadFactory))
    .orElseGet(() -> Executors.newCachedThreadTool(threadFactory))

useful when refactoring legacy code with existing threadFactory
@maxxedev maxxedev force-pushed the issue-37-executor-tool-thread-factory branch from db53036 to dfa89c2 Compare June 3, 2025 05:41
@maxxedev maxxedev merged commit 8aaf0e1 into main Jun 3, 2025
8 checks passed
@maxxedev maxxedev deleted the issue-37-executor-tool-thread-factory branch June 3, 2025 05:43
@maxxedev
Copy link
Contributor Author

maxxedev commented Jun 3, 2025

fixes issue #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant